setAudioAttributes(samplingrate=44100, controlrate=11025)
setGlobalDuration(-1)

oscReceive(bus=['met', 'rev'], address=['/met', '/rev'], port=8000, portamento=.025)

tab = genWaveform()
ryt = genDataTable([1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0])
pit = genDataTable([1,.75,.5,.25,.5,.75,1,.5,.75,25,.5,1,1.25,1.5,1.25,1])
env = genAdsr()
metro(bus='metro', tempo=260, tempoVar='met')

beginSequencer(input='metro', table=ryt)
sequencerPitchTable(pit)
pitchs = [(random.random()*.03-.015+1.)*100 for i in range(10)]
waveform(pitch=pitchs, amplitude=.35, duration=.25, table=tab, envelope=env, out='fromwav')
endSequencer()

waveguideReverb(input='fromwav', mix=.7, mixVar='rev')

proc = startCsound()

def taps(list):
    reGenDataTable(ryt, list, proc)

def wave(list):
    reGenWaveform(table=tab, list=list, process=proc)

def regenpit(list):
    reGenDataTable(pit, list, proc)

def slide(list):
    sendOscControl(value=list[0], address='/met')
    sendOscControl(value=1-list[1], address='/rev')

pittab = [2,.75,2,.25,.5,.75,1,.5,.75,2,.5,1,1.25,1.5,1.25,1]
frame = beginGUI(size=(500,550))
makeMultiSlider(frame, label='waveform harmonics strength', init=[1,0,.3,0,.2,0,.1,0,.06,0,.03,0,.02], sliders=16, 
                pos=(30,30), function=wave)
makeMultiSlider(frame, label='Tap sequencer', init=[1,.25,.75,.25,1,.25,1,.25,1,.25,.25,1,.25,.25,1,1], sliders=16, 
                pos=(30,270), function=taps)
makeMultiSlider(frame, label='Pitch table', init=pittab, sliders=16, 
                pos=(260,270), maxi=2, function=regenpit)
makeXYSlider(frame, label='speed - reverb mix', pos=(260,30), function=slide)
endGUI(frame)